package com.trkj.property_controller;

import com.trkj.entity.YardEntity;
import com.trkj.service.YardService;
import com.trkj.vo.AjaxResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/Yard")
public class YardController {
    @Resource
    private YardService yardService;

    @PostMapping("/insertYard")
    public AjaxResponse insertYard(@RequestBody YardEntity yardEntity){
        return AjaxResponse.success(yardService.insertYard(yardEntity));
    }

    @GetMapping("selectYard")
    public AjaxResponse selectYard(){
        return AjaxResponse.success(yardService.selectYard());
    }

    @PutMapping("updateYard")
    public AjaxResponse updateYard(@RequestBody YardEntity yardEntity){
        return AjaxResponse.success(yardService.updateYard(yardEntity));
    }

    @DeleteMapping("deleteYard/{id}")
    public AjaxResponse deleteYard(@PathVariable("id") int id){
        return AjaxResponse.success(yardService.deleteYard(id));
    }


    @GetMapping("selectCar/{id}")
    public AjaxResponse selectCar(@PathVariable("id") int id){
        return AjaxResponse.success(yardService.selectCar(id));
    }

}